package org.jeecg.modules.flower.listener;

/**
 * @author gf
 * @create 2022-12-21 15:38
 */

import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.EngineServices;
import org.activiti.engine.HistoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.delegate.*;
import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.VariableInstance;
import org.activiti.engine.impl.pvm.process.TransitionImpl;
import org.jeecg.modules.flower.controller.DeleteWrongIn;

import java.util.Map;

/**
 *
 * @ClassName MyTaskListener
 * @description: TODO
 * @author gf
 * @datetime 2022年 12月 21日 15:38
 * @version: 1.0
 **/

@Slf4j
public class MyTaskListener implements   ExecutionListener, TaskListener, ActivitiEventListener {


    @Override
    public void notify(DelegateExecution execution) throws Exception {

        System.out.println("流程监听器" + execution.getEventName() );
        log.info( execution.getId());

//        怎么获取业务数据id。

        TransitionImpl transition = ((ExecutionEntity) execution).getTransition();

        String processBusinessKey = execution.getProcessBusinessKey();

        DeleteWrongIn deleteWrongIn =new DeleteWrongIn();
        deleteWrongIn.tt(processBusinessKey);


        

    }

    @Override
    public void notify(DelegateTask delegateTask) {
        System.out.println("流程监听器" + delegateTask.getName());
        System.out.println("流程监听器" + delegateTask.getId());

    }

    @Override
    public void onEvent(ActivitiEvent activitiEvent) {
        log.info("sssssssssssssssssssssssssssss");
        log.info("sssssssssssssssssssssssssssss");
        log.info("sssssssssssssssssssssssssssss");
        log.info("sssssssssssssssssssssssssssss");

    }

    @Override
    public boolean isFailOnException() {


        return false;
    }
}